package com.gpms.service;


import java.util.List;

import com.gpms.bean.Student;
import com.gpms.bean.Topics;
import com.gpms.dao.HibernateDaoFactory;
import com.gpms.dao.IHibernateDao;
import com.gpms.dao.ITopicsDao;

public class SetLanguageService 
{
	public String setLanguage(Student student , String languageType){
		String hql="update Topics t set t.languageType='"+languageType+"' where t.student.studentNum='"+student.getStudentNum()+"'";
		ITopicsDao dao = (ITopicsDao)HibernateDaoFactory.createDao("topicsDao");
		String result = dao.modify(hql);
		return result;
	}
	public String getLanguage(Student student)
	{
		String hql="from Topics t where t.student.studentNum='"+student.getStudentNum()+"'";
		IHibernateDao dao = HibernateDaoFactory.createDao("topicsDao");
		List<Object> list = dao.selectByHql(hql);
		Topics topics = (Topics)list.get(0);
		String languageType = topics.getLanguageType();
		return languageType;
		
	}
	public static SetLanguageService getInstance()
	{
		return new SetLanguageService();
	}
	
}
